﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Data;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
  public  class Emp_JYModel
    {
        private int _Id;
        [DataMember]
        public int Id
        {
            get { return _Id; }
            set { _Id = value; }
        }
        private DateTime? _TLDate;
         [DataMember]
        public DateTime? TLDate
        {
            get { return _TLDate; }
            set { _TLDate = value; }
        }
         private string _Name;
         [DataMember]
         public string Name
         {
             get { return _Name; }
             set { _Name = value; }
         }
         private int _EID;
         [DataMember]
         public int EID
         {
             get { return _EID; }
             set { _EID = value; }
         }
         private string _OldKS;
         [DataMember]
         public string OldKS
         {
             get { return _OldKS; }
             set { _OldKS = value; }
         }
         private string _OldZW;
         [DataMember]
         public string OldZW
         {
             get { return _OldZW; }
             set { _OldZW = value; }
         }
         private string _BeginDate;
         [DataMember]
         public string BeginDate
         {
             get { return _BeginDate; }
             set { _BeginDate = value; }
         }
         private string _EndDate;
         [DataMember]
         public string EndDate
         {
             get { return _EndDate; }
             set { _EndDate = value; }
         }
         private string _NewDW;
         [DataMember]
         public string NewDW
         {
             get { return _NewDW; }
             set { _NewDW = value; }
         }
         private string _NewKS;
         [DataMember]
         public string NewKS
         {
             get { return _NewKS; }
             set { _NewKS = value; }
         }
         private string _NewZW;
         [DataMember]
         public string NewZW
         {
             get { return _NewZW; }
             set { _NewZW = value; }
         }
         private string _Status;
         [DataMember]
         public string Status
         {
             get { return _Status; }
             set { _Status = value; }
         }
         private string _CreateUser;
         [DataMember]
         public string CreateUser
         {
             get { return _CreateUser; }
             set { _CreateUser = value; }
         }
         private DateTime? _CreateDate;
         [DataMember]
         public DateTime? CreateDate
         {
             get { return _CreateDate; }
             set { _CreateDate = value; }
         }
         private bool isselected = false;
         [DataMember]
         public bool IsSelected
         {
             get { return isselected; }
             set { isselected = value; }
         }
         private int _Sequence;
         [DataMember]
         public int Sequence
         {
             get { return _Sequence; }
             set { _Sequence = value; }
         }
         public static Emp_JYModel FillEntity(DataRow dr)
         {
             Emp_JYModel right = new Emp_JYModel();
             right.IsSelected = dr["IsSelected"].ToString() == "false" ? false : true;
             right.Sequence = Convert.ToInt32(dr["Sequence"]);
             if (dr.Table != null && dr.Table.Columns.Contains("Id"))
                 right.Id = Convert.ToInt32(dr["Id"]);
             if (dr.Table != null && dr.Table.Columns.Contains("TLDate")) right.TLDate = Convert.ToDateTime(dr["TLDate"]);
             if (dr.Table != null && dr.Table.Columns.Contains("Name"))
                 if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("EID"))
                 if (!string.IsNullOrEmpty(dr["EID"].ToString()))
                     right.EID =Convert.ToInt32(dr["EID"]);
             if (dr.Table != null && dr.Table.Columns.Contains("OldKS"))
                 if (!string.IsNullOrEmpty(dr["OldKS"].ToString())) right.OldKS = dr["OldKS"].ToString();

             if (dr.Table != null && dr.Table.Columns.Contains("OldZW"))
                 if (!string.IsNullOrEmpty(dr["OldZW"].ToString())) right.OldZW = dr["OldZW"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("BeginDate"))
                 if (!string.IsNullOrEmpty(dr["BeginDate"].ToString())) right.BeginDate =Convert.ToDateTime(dr["BeginDate"].ToString()).ToString("yyyy-MM-dd");
             if (dr.Table != null && dr.Table.Columns.Contains("EndDate"))
                 if (!string.IsNullOrEmpty(dr["EndDate"].ToString())) right.EndDate = Convert.ToDateTime(dr["EndDate"].ToString()).Year == 1900 ? "" : Convert.ToDateTime(dr["EndDate"].ToString()).ToString("yyyy-MM-dd");
             if (dr.Table != null && dr.Table.Columns.Contains("NewDW"))
                 if (!string.IsNullOrEmpty(dr["NewDW"].ToString())) right.NewDW = dr["NewDW"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("NewKS"))
                 if (!string.IsNullOrEmpty(dr["NewKS"].ToString())) right.NewKS = dr["NewKS"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("NewZW"))
                 if (!string.IsNullOrEmpty(dr["NewZW"].ToString())) right.NewZW = dr["NewZW"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("Status"))
                 if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("CreateUser"))
                 if (!string.IsNullOrEmpty(dr["CreateUser"].ToString())) right.CreateUser = dr["CreateUser"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("CreateDate"))
                 if (!string.IsNullOrEmpty(dr["CreateDate"].ToString())) right.CreateDate =Convert.ToDateTime(dr["CreateDate"].ToString());
             return right;
         }
    }
}
